
// mixin.js
export const defaultCustomModal = {
  show: false,
  title: '',
  content: '',
  confirmText: '确定',
  cancelText: '取消',
  cancelColor: 'rgba(0, 0, 0, 0.85)',
  confirmColor: '#666666',
  success: null
}
export const showCustomModalMixin = {
  methods: {
    showCustomModal(modalParam){
      console.log('显示自定义对话框', modalParam)
      let showCustomModal = Object.assign(this.$store.state.showCustomModal, modalParam)
      if(modalParam.reverse){
        let tmp = showCustomModal.cancelColor
        showCustomModal.cancelColor = showCustomModal.confirmColor
        showCustomModal.cancelColor = tmp
      }
      showCustomModal.show = true
      this.$store.commit('updateShowCustomModal',showCustomModal)
    },
    hideCustomModal(){
      this.$store.commit('updateShowCustomModal',Object.assign({}, defaultCustomModal))
      this.$store.commit('hideShowCustomModal')
    }
  }
}
